﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ParallelRuntimeLibrary.Collections;
using ParallelRuntimeLibrary;
using System.Diagnostics;

namespace TestProject
{
    static class ListTester
    {
        static ConcurrentList<string> X;
        public static void Start()
        {
            X = new ConcurrentList<string>(1, ListConcurrentModes.Lock);

            Task[] Ts = new Task[4];
            for (int i = 0; i < Ts.Length; i++)
                Ts[i] = new Task(ThreadWork, i.ToString());

            Stopwatch SW = new Stopwatch();
            SW.Start();

            TaskManager.WaitAll(Ts);

            SW.Stop();

            Console.WriteLine(SW.ElapsedMilliseconds);
            Console.ReadLine();
        }

        public static void ThreadWork(object str)
        {
            for (int i = 0; i < 1000000; i++)
                X.Add((str as string) + i.ToString());

            X.Clear();

            for (int i = 0; i < 500000; i++)
                X.Add((str as string) + "  :  " + i.ToString());
        }

    }
}
